package cate.common.table.trademall.privilege;


import cate.common.table.ERow;
import cate.common.table.XSSFRowWrap;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

@NoteClass(value = "特权商城表")
public class PrivilegeMallItemRow extends ERow {
    @NoteField("特权购买奖励")
    public String firstBuyReward;

    @NoteField("特权每日奖励")
    public String dailyReward;

    @NoteField(value = "特权绑定功能")
    public int bindFuncId;

    @NoteField(value = "特权周期", detail = "天")
    public int cycle;

    @NoteField(value = "续费通知日期", detail = "天")
    public int renewDay;

    @NoteField(value = "购买类型")
    public int buyType;

    @NoteField(value = "购买资源")
    public String  price;

    @NoteField(value = "购买价格")
    public int  rmbPrice;

    @NoteField("支付项配置")
    public int payItemId;

    @NoteField("邮件ID")
    public int mailId;

    @NoteField("开启天数")
    public int openDay;

    @NoteField("购买后转变永久次数")
    public int forerverTimes;

    @NoteField("限时活动开服天数")
    public int limitDay;

    @NoteField("限时活动奖励")
    public String limitReward;

    @NoteField("限时活动邮件ID")
    public int limitMailId;

    @NoteField("激活特权消耗道具")
    public String cost;

    @NoteField("跑马灯公告")
    public int lampId;
    @Override
    public void parse(XSSFRowWrap xr) {
        this.id = xr.getInteger("ID");
        this.firstBuyReward = xr.getString("特权购买奖励");
        this.dailyReward = xr.getString("特权每日奖励");
        this.bindFuncId = xr.getInteger("特权绑定功能", 0);
        this.cycle = xr.getInteger("特权周期", 0);
        this.renewDay = xr.getInteger("续费通知日期", 0);
        this.buyType = xr.getInteger("购买类型", 1);
        this.price = xr.getString("购买资源");
        this.rmbPrice = xr.getInteger("购买价格",0);
        this.payItemId = xr.getInteger("支付项配置", 0);
        this.mailId = xr.getInteger("邮件ID", 0);
        this.openDay = xr.getInteger("开启天数", 1);
        this.forerverTimes = xr.getInteger("购买后转变永久次数", -1);
        this.limitDay = xr.getInteger("限时活动开服天数", 0);
        this.limitReward = xr.getString("限时活动奖励");
        this.limitMailId = xr.getInteger("限时活动邮件ID",0);
        this.cost = xr.getString("激活特权消耗道具");
        this.lampId = xr.getInteger("跑马灯公告",0);


    }

    /**
     * 特权持续时间（限购周期）
     */
    public long cycleMilliSecond;

    public long renewDayMilliSecond;

    @Override
    public void decode() {
        cycleMilliSecond = 0L;
        if (cycle > 0) {
            cycleMilliSecond = cycle * 1000L * 24 * 60 * 60;
        }
        if (renewDay > 0) {
            renewDayMilliSecond = renewDay * 1000L * 24 * 60 * 60;
        }
    }
}
